<?php

//路由组
//中间件 middleware
//路由前缀 prefix
//默认命名空间 namespace
Route::group(['middleware' => 'web', 'prefix' => 'admin', 'namespace' => 'Modules\Admin\Http\Controllers'], function()
{

    Auth::routes();


});
//判断是否登录登陆之后才可以进入
Route::group(['middleware' => ['web','auth:admin'], 'prefix' => 'admin', 'namespace' => 'Modules\Admin\Http\Controllers'], function()
{
    //不把中间件写到组里是因为：每一种路由方式不同，调用的中间件不同

    //加载后台首页路由
    Route::get('/', 'AdminController@index');
    //加载用户管理路由
    //这里的中间件到app/Http/Kernel/$routeMiddleware里找
    //在 app/Http/Kernel.php 文件的 $routeMiddleware 段添加中间件
    //判断用户操作有没有权限
    Route::resource('/adminuser','AdminUserController')->middleware('permission:admin,resource');
    //用户查看角色路由
    Route::get('/showrole/{adminid}','AdminUserController@ShowRole')->name('showrole')->middleware('permission:admin');
    //用户角色分配功能路由
    Route::post('/distributionrole/{adminid}','AdminUserController@DistributionRole')->name('distributionrole')->middleware('permission:admin');
   //加载角色管理路由
    Route::resource('/role','RoleController')->middleware('permission:admin,resource')->middleware('permission:admin,resource');
    //查看权限分配路由
    Route::get('/permission/{roles}','RoleController@ShowPermission')->name('permission')->middleware('permission:admin');
    //权限提交路由
    Route::post('/jurisdiction/{roles}','RoleController@Jurisdiction')->name('jurisdiction');

});